
$(function () {
    initDatagrid();
    $("#queryButton").click(function(){
        $("#listTable").datagrid('load',{
            queryStr:$("#queryStr").val(),
            beginTime:$("input[name=beginTime]").val(),
            endTime:$("input[name=endTime]").val()

        })
    })

});



// 表格内容初始化
function initDatagrid() {
    var url = $.util.getRequestJson('/json/dataQuery.messageList.json');
    $('#listTable').datagrid({
        url: url /*+ '?type=0'*/,
        idField:'id',
        fit: true,
        pagination: true,
        pageSize: 1,
        pageList:[1,2,3],
        checkOnSelect: false,
        selectOnCheck: false,
        singleSelect: true,
        toolbar: '#toolbarButton',
        fitColumns: true,
        columns: [
            [
                {
                    field: 'messageContent',
                    title: '消息内容',
                    width:12
                },
                {
                    field: 'phone',
                    title: '客户手机号',
                    width:12
                },
                {
                    field: 'name',
                    title: '客户姓名',
                    width:12
                },
                {
                    field: 'expendScore',
                    title: '消费积分',
                    width:12
                },
                {
                    field: 'expendTime',
                    title: '消费时间',
                    width:12
                }, {
                field: 'id',
                title: '操作',
                align: 'center',
                width:12,
                formatter: function (value, row) {

                        aEl = '<a href=javascript:messageDetail("{0}"); class="easyui-tooltip " title="兑换">详情</a>';



                    //格式化操作按钮
                    return $.string.format(aEl, row.id);
                }
            }
            ]
        ]
    });
}
// 查看订单详情   订单id
function messageDetail(orderId){

    var title = "详情";
    var url = $.util.getRootPath() + '/page/shopManager/message/messageDetail.html';
    var dialog = $.easyui.showDialog({
        iconCls:"",
        title: title,
        width: 800,
        height: 400,
        maximizable: true,
        href: url,
        topMost: true,
        saveButtonText: '确认',
        onSave: function () {
            dialog.dialog('close');
        }
    });
}
